home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
music
/
87
/
c
/
numview.c
< prev
next >
Wrap
C/C++ Source or Header
|
1986-12-19
|
2KB
|
66 lines
/* NUMVIEW.C Dan Stubbs 12/5/86 */
/* This program loads a number of your choice into each and */
/* every word of screen memory. Now you can see a decimal */
/* number of your choosing displayed as 16 bit words in high */
/* resolution, or combining bits from 2 consecutive words in */
/* medium resolution or from 4 consecutive words in low */
/* resolution. Inspired by P. I. Nelson's Neoview */
/* Try some negative numbers, too! */
#include <osbind.h>
#include <stdio.h>
char input[10],answer[10];
char message1[] = "Enter an integer to be displayed: ";
char mess2[] = "When finished viewing hit any key..........\n\r";
char question[] = "Do you want to view another number?[Y]";
char dummy[6];
int *screen;
main()
{
int i,j,number;
char c = 'y';
Cursconf(0,0); /* This makes cursor disappear */
screen = (int *) Physbase(); /* This finds address of display screen */
while ((c != 'n') && (c != 'N'))
{
input[0] = 8; /* This tells Cconrs() how many characters to expect */
Cconws(mess2);
Cconws(message1);
/* The following gets a number from the keyboard that is terminated */
/* by a carriage return. Alcyon's scanf() is terminated by a space */
/* -- not a very standard user interface to my way of thinking */
Cconrs(input); /* Gets our number */
input[input[1]+2] = '\0'; /* Puts a null termination */
for(j=0; j <= input[1]; j=j+1)
{
dummy[j]=input[j+2]; /* Puts digits into array for */
} /* sscanf() */
sscanf(dummy,"%d",&number);
{
for(i=1; i < 16000; i=i+1)
{
*(screen+i)=number; /* Write number into screen */
}
}
Bconin(2); /* Waits for a key press */
answer[0] = 7; /* Once again avoiding scanf() */
Cconws(question);
Cconrs(answer);
answer[answer[1]+2] = '\0';
for(j=0; j <= answer[1]; j=j+1)
{
dummy[j] = answer[j+2];
}
sscanf(dummy,"%s",&c);
}
} /* The end */